package org.cuijq.thinking.in.spring.bean.factory;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class DefaultFactory implements UserFactory, InitializingBean, DisposableBean {

    @PostConstruct
    public void init(){
        System.out.println("PostConstruct  UserFactory 初始化中");
    }

    public void inituserFactory(){
        System.out.println("自定义 initer inituserFactory");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("属性设置之后 afterPropertiesSet");
    }

    @PreDestroy
    public void preDestory(){
        System.out.println("PreDestroy  bean 销毁中");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean  bean 销毁中");
    }

    public void doDestory(){
        System.out.println("自定义 doDestory");
    }

    @Override
    protected void finalize() throws Throwable {
        System.out.println("当前对象 正在被回收");
    }
}
